quitPlayerHandler = {}
local this = quitPlayerHandler;
G.serverData = G.serverData or {};
--请求当前
function quitPlayerHandler.ResQuitPlayer(msg)
    if msg.state ~= 0 then
        return;
    end
    Game.stopHeart()
    if msg.reason == 3 then
        UISysTips.AddMsg("您已被封号!");
    elseif msg.reason == 4 then
        UISysTips.AddMsg("服务器已关闭!");
      
    elseif msg.reason == 5 then
        UISysTips.AddMsg("gm踢下线!");
    end
    
    local pop = CtrlManager.GetCtrl(PanelNames.UICommonPop)
    pop.Init(36, function()
        this.DelayQuitGame()
    end)
end

function quitPlayerHandler.DelayQuitGame()
    utimer.delayCall(function()
        this.QuitGame()
    end, 2000 )
end

function quitPlayerHandler.QuitGame()
    logicMgr.LoginManager.SetAutoLogin(false)
    Game.ResetStart(false)
    Game.stopHeart()
    LoginSDK.GetInstance():LoginOutU8SDK()
    SDKManager.IMDisconnect()
    MercenaryModel.resetMercenary();
	collectgarbage("collect");
	 
	--显示login界面
	local login = CtrlManager.GetCtrl(PanelNames.UILogin);
    if login ~= nil then
        login.Init();
    end

    --特殊处理
    --GuildWarManager.Reset()
	
	Game.sendPingTime = 0;

end
